package kr.pe.johnkim.checkmileage.mobile.rest.dao;

import kr.pe.johnkim.checkmileage.mobile.domain.CheckMileageMerchantMarketing;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;

/**
 * Check Mileage 마케팅 관련 DAO 메소드들을 구현하는 클래스 이다.
 *
 * @author : johnkim <cale9797@gmail.com / Bettersoft, Inc.>
 * @date: 12. 10. 20.
 */
public class CheckMileageMerchantMarketingDaoImpl extends SqlMapClientDaoSupport implements CheckMileageMerchantMarketingDao {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(CheckMileageMerchantMarketingDaoImpl.class);

    /**
     * 마케팅을 등록 한다.
     *
     * @param checkMileageMerchantMarketing
     */
    @Override
    public void registerMarketing(CheckMileageMerchantMarketing checkMileageMerchantMarketing) {
        logger.info("registerMarketing");

        getSqlMapClientTemplate().insert("CHECKMILEAGE_MARKETINGS.registerMarketing", checkMileageMerchantMarketing);
    }

    /**
     * 마케팅을 업데이트 한다.
     *
     * @param checkMileageMerchantMarketing
     */
    @Override
    public void updateMarketing(CheckMileageMerchantMarketing checkMileageMerchantMarketing) {
        logger.info("updateMarketing");

        getSqlMapClientTemplate().update("CHECKMILEAGE_MARKETINGS.updateMarketing", checkMileageMerchantMarketing);
    }

    /**
     * 마케팅 목록을 가져 온다. 사용자 smart phone 에 출력.
     *
     * @param checkMileageMerchantMarketing
     * @return
     */
    @Override
    public List<CheckMileageMerchantMarketing> selectMemberMerchantMarketingList(CheckMileageMerchantMarketing checkMileageMerchantMarketing) {
        logger.info("selectMemberMerchantMarketingList");

        return this.getSqlMapClientTemplate().queryForList("CHECKMILEAGE_MARKETINGS.selectMemberMerchantMarketingList", checkMileageMerchantMarketing);
    }

    /**
     * 마케팅 목록을 가져 온다. 가맹점 iPad/Web site 에 출력.
     *
     * @param checkMileageMerchantMarketing
     * @return
     */
    @Override
    public List<CheckMileageMerchantMarketing> selectMerchantMemberMarketingList(CheckMileageMerchantMarketing checkMileageMerchantMarketing) {
        logger.info("selectMerchantMemberMarketingList");

        return this.getSqlMapClientTemplate().queryForList("CHECKMILEAGE_MARKETINGS.selectMerchantMemberMarketingList", checkMileageMerchantMarketing);
    }

    /**
     * 마케팅을 비활성화 한다.
     *
     * @param checkMileageMerchantMarketing
     */
    @Override
    public void updateDeactivateMarketing(CheckMileageMerchantMarketing checkMileageMerchantMarketing) {
        logger.info("updateDeactivateMarketing");

        getSqlMapClientTemplate().update("CHECKMILEAGE_MARKETINGS.updateDeactivateMarketing", checkMileageMerchantMarketing);
    }
}
